package com.android.bonn.fast.adapter;

/**
 * author huangyunlin@snqu.com
 * date 2018/11/14
 * description
 */
final class CellTypes<MODEL, VIEW extends CellView<MODEL>> {

    private int modelType;
    private CellViewCreator<MODEL, VIEW> cellViewCreator;
    private CellViewType cellViewType;
    private OnItemViewClickListener<MODEL> listener;

    CellTypes(int modelType, CellViewCreator<MODEL, VIEW> cellViewCreator) {
        this.modelType = modelType;
        this.cellViewCreator = cellViewCreator;
        this.cellViewType = cellViewCreator.isCellViewType();
    }

    CellTypes(int modelType, CellViewCreator<MODEL, VIEW> cellViewCreator, OnItemViewClickListener<MODEL> listener) {
        this.modelType = modelType;
        this.cellViewCreator = cellViewCreator;
        this.cellViewType = cellViewCreator.isCellViewType();
        this.listener = listener;
    }

    CellViewCreator<MODEL, VIEW> getCellViewCreator() {
        return cellViewCreator;
    }

    public OnItemViewClickListener<MODEL> getListener() {
        return listener;
    }

    int getModelType() {
        return modelType;
    }

    boolean typeOfView(int index, Object item) {
        return cellViewType.typeOf(index, item);
    }


}
